package emulator.unittest.support;


import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

import emulator.support.CpuState;

public class CpuStateTest {
	private CpuState cpu_state;

	@Before
	public void setUp() throws Exception {
		cpu_state = new CpuState();
	}

	@Test(expected=IndexOutOfBoundsException.class)
	public void testGetUndefinedValue()
	{
		cpu_state.getValue("A");
	}
	
	@Test
	public void testSetGetValue()
	{
		cpu_state.setValue("A", 123);
		assertEquals(123, cpu_state.getValue("A"));
	}

	@Test(expected=IndexOutOfBoundsException.class)
	public void testGetUndefinedValueAfterSet()
	{
		cpu_state.setValue("B", 815);
		cpu_state.getValue("A");
	}
	
}
